/*
 * main.c
 *
 *  Created on: 29/gen/2014
 *      Author: Postazione Embedded
 */
//TX mario, RX diana
//canale 7a

#include "stm32f4xx.h"
#include "nrf24l01p/dl.h"

#define LENGTH		1024
uint8_t tx_buffer[LENGTH];


void loopt() {
	//TxPacket(tx_buffer, LENGTH, 0x02);
	//tx_buffer[0] = 0x02;
	TxBroadcast_nRF24L01P(tx_buffer, 32);
	printf("Pacchetto trasmesso a 0x02!!\n");
	//toggleLeds(LED[1]);
	nRF24L01_Delay_us(500000);
	//tx_buffer[0] = 0x03;
	//TxBroadcast_nRF24L01P(tx_buffer, LENGTH);
	//printf("Pacchetto trasmesso a 0x03!!\n");
	//toggleLeds(LED[1]);
	//nRF24L01_Delay_us(5000000);

}

int main() {
	int j = 0;
	setup_nRF24L01P();
	RxMode_nRF24L01P();
	for(; j < LENGTH; j++){
		tx_buffer[j+2] = 1;
	}
	tx_buffer[0] = (LENGTH & 0xff00) >> 8;
	tx_buffer[1] = LENGTH & 0x00ff;
	tx_buffer[2] = 0x0A;
	tx_buffer[LENGTH-1] = 0x0A;
	printf("main\n");

	while (1) {
		loopt();
		//RxPacket(tx_buffer);
		toggleLeds(LED[1]);
	}
}

